#include "Keyboard.h"

Keyboard::Keyboard(void)
{
	for(int i = 0; i < this->keyArraySize; i++)
	{
		this->keyState[i] = false;
	}

	for(int i = 0; i < this->specialKeyArraySize; i++)
	{
		this->specialKeyState[i] = false;
	}
}


Keyboard::~Keyboard(void)
{
}

void Keyboard::UpdateKeyDown(unsigned char key)
{
	this->keyState[(unsigned short)key] = true;
	if((unsigned short)key == 27)
		specialKeyState[(unsigned short)key] = true;
}

void Keyboard::UpdateKeyUp(unsigned char key)
{
	this->keyState[(unsigned short)key] = false;
	if((unsigned short)key == 27)
		specialKeyState[(unsigned short)key] = false;
}

void Keyboard::UpdateSpecialKeyDown(int key)
{
	this->specialKeyState[key] = true;
}

void Keyboard::UpdateSpecialKeyUp(int key)
{
	this->specialKeyState[key] = false;
}

bool Keyboard::IsSpecialKeyDown(SpecialKey key)
{
	return this->specialKeyState[key];
}

bool Keyboard::IsKeyDown(char key)
{
	return this->keyState[(unsigned short)key];
}